package com.jiuyin.dianjing.adapter;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

/**
 * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
 * one of the sections/tabs/pages.
 *
 * @author Administrator
 */
public class SectionsPagerAdapter extends FragmentPagerAdapter {

    private final List<Fragment> fragmentIfs;

    /**
     * Instantiates a new Sections pager adapter.
     *
     * @param fm           the fm
     * @param fragmentList the fragment list
     */
    public SectionsPagerAdapter(FragmentManager fm, List<Fragment> fragmentList) {
        super(fm);
        this.fragmentIfs = fragmentList;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentIfs.get(position);
    }

    @Override
    public int getCount() {
        return fragmentIfs == null ? 0 : fragmentIfs.size();
    }

}